<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 3. 封装一个函数 求数组中的最大值
        function max(a) {
            //先找最大值 然后在封装 不然我脑子转不过来
            var max1 = a[0];
            for (var i = 1; i < a.length; i++) {
                if (max1 < a[i]) {
                    max1 = a[i];
                }
            }
            return max1;
        }
        var arr = [52, 15, 17, 54, 24, 30];
        var arr1 = [63,79,42,62,45,99];
        var arr2 = [41,63,48,82,75];
        var ssmax = max(arr);
        var sssmax = max(arr1);
        var ssssmax = max(arr2);
        console.log(ssmax);
        console.log(sssmax);  
        console.log(ssssmax);

    </script>
</body>

</html>